package com.example.zcx.base;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

import com.example.zcx.base.presenter.BasePresenter;
import com.example.zcx.base.view.IView;

import butterknife.Unbinder;

public abstract class BaseActivity<V extends IView,P extends BasePresenter<V>> extends AppCompatActivity implements IView{

    private BaseApplication baseApplication;

    private P basePresenter;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        onCreateView(savedInstanceState);
    }

    protected abstract P setPresenter();

    public P getBasePresenter() {
        return basePresenter;
    }

    protected V getBaseView() {
        return (V) this;
    }

    /**
     * 初始化布局
     */
    protected abstract void onCreateView(Bundle savedInstanceState);

    /**
     * 初始化数据
     */
    protected abstract void initData();

    /**
     * 所有监听的方法都在该类中实现
     */
    protected abstract void initListener();
}
